<%--
  Created by IntelliJ IDEA.
  User: jzj15
  Date: 2024/6/10
  Time: 20:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="/test1/ControlServlet" method="post" onsubmit="return b()">
    商品名称:<input type="text" name="name" id="name"><br>
    商品进价:<input type="text" name="in_price" id="in_price"><br>
    商品定价:<input type="text" name="price" id="price"><br>
    商品数量:<input type="text" name="count" id="count"><br>
    上架状态:<select name="status" id="a">
    <option value="1" >下架</option>
    <option value="2" >上架</option>
</select>
    <input  type="submit" value="保存">
</form>

    <script>
        function b(){
            var name=document.getElementById("name").value
            var price=document.getElementById("price").value
            var in_price=document.getElementById("in_price").value
            var count=document.getElementById("count").value
            var a=document.getElementById("a").value
                if (name==""){
                    alert("请输入商品名")
                    return false
                }
                if (in_price==""){
                    alert("请输入进价")
                return false
                }if (price==""){
                    alert("请输入售价")
                return false
                }if (count==""){
                    alert("请输入数量")
                return false
                }
                if (a=="1") {
                    alert("修改成功")
                }else if (a=="2"){
                    alert("上架成功")
                }
                alert("成功提交")
                return true
            };
    </script>


</body>
</html>
